package com.bw.zg3park2212.adpter

import android.widget.TextView
import com.bw.base.entity.PointEntityItem
import com.bw.zg3park2212.R
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

class PointAdpter:BaseQuickAdapter<PointEntityItem,BaseViewHolder>(R.layout.item_point) {
    override fun convert(helper: BaseViewHolder, item: PointEntityItem) {
        helper.setText(R.id.patrol_Name,"项目名称/"+item.pointName)
        helper.setText(R.id.patrol_area,"点位位置: "+item.pointLocation)
        val type = helper.getView<TextView>(R.id.patrol_type)
        if(item.patrolType=="保洁巡检"){
            type.setBackgroundResource(R.drawable.bg_kongxian)
            type.setTextColor(context.getColor(R.color.color_kongxian))
            type.setText("保洁巡检")
        }else if(item.patrolType=="安防巡检"){
            type.setBackgroundResource(R.drawable.bg_zganyong)
            type.setTextColor(context.getColor(R.color.color_zhanyong))
            type.setText("安防巡检")
        }else if(item.patrolType=="日常巡检"){
            type.setBackgroundResource(R.drawable.bg_weihu)
            type.setTextColor(context.getColor(R.color.color_weihu))
            type.setText("日常巡检")
        }else{
            type.setBackgroundResource(R.drawable.bg_hui)
            type.setTextColor(context.getColor(R.color.color_hui))
            type.setText("家居巡检")
        }
    }
}